module.exports = class index extends require('../utils/connection') {
	static findAllList(value) {
		return new Promise((resolve, reject) => {
			let sql = "select * from login"
			this.query(sql).then(res => {
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	}

	static login (username,password) {
		return new Promise((resolve,reject) => {
			let sql = `select l.password,u.* from login l,userinfo u where
			 	l.username='${username}'and l.userid=u.id`;
			this.query(sql).then(res => {
				// console.log(res[0].password,'xxxxxx');
				if(res[0].password === password) resolve(res)
				else resolve([])
				// resolve(res)
			}).catch(err => {
				console.log(err);
				reject('登录失败')
			})
		}) 
	}
}